package com.aabte.commons.json;

import java.io.Reader;
import java.lang.reflect.Type;

/**
 * 从gson移植
 *
 * @author Daniel
 * @version 1.0
 * @date 2020/4/5
 */
public interface JSONSerializationAdapter {

  String toJson(Object src) throws JSONException;

  String toJson(Object src, Type typeOfSrc) throws JSONException;

  void toJson(Object src, Appendable writer) throws JSONIOException;

  <T> T fromJson(String json, Type typeOfT) throws JSONSyntaxException;

  <T> T fromJson(String json, Class<T> classOfT) throws JSONSyntaxException;

  <T> T fromJson(String json, Class<T> classOfT, Type... typeArguments) throws JSONSyntaxException;

  <T> T fromJsonArray(String json, Type typeArguments)
      throws JSONSyntaxException;

  <T> T fromJson(Reader json, Class<T> classOfT) throws JSONSyntaxException;

  <T> T fromJson(Reader json, Type typeOfT) throws JSONSyntaxException;
}
